/**
 * Set
 * 用它最主要的功能就是去除数组重复内容
 * Set是没有顺序且不能重复的集合，所以不能通过索引去获取值
 */
void main(List<String> args) {
  var s = new Set();
  s.add('香蕉');
  s.add('苹果');
  s.add('苹果');
  print(s);
  print(s.toList());

  List myList = ['香蕉', '苹果', '西瓜', '香蕉', '苹果', '西瓜'];
  print(myList);
  var s1 = new Set();
  s1.addAll(myList);
  print(s);
  print(s1.toList());

  for (int i = 0; i < myList.length; i++) {
    print(myList[i]);
  }

  print("********item");
  for (var item in myList) {
    print(item);
  }
  print("*****foreach");
  myList.forEach((element) {
    print(element);
  });

  List myList1 = [1, 3, 4, 5, 7, 8, 9];
  // List newList = new List();
  var newList = myList1.map((e) => e * 2);
  print(newList.toList());
  var newListWhere = myList1.where((element) => element > 5);
  print(newListWhere);

  print("循环迭代");
  s.forEach((element) {
    print(element);
  });
}
